--*****************************************************************************
--*     DB Creation Script :: ExceptionLog Table
--*     Copyright (C) 2003, Perot Systems Corporation. All right reserved.
--*****************************************************************************
--* Developer: Dmitry Frenkel

 
--*****************************************************************************
--* Step 1. Create Table
--*****************************************************************************
SET NOCOUNT OFF

PRINT 'Creating Table ExceptionLog...'
GO

IF OBJECT_ID( 'ExceptionLog' ) IS NULL
BEGIN
	CREATE TABLE [DBO].ExceptionLog
	(
		[OID] BIGINT IDENTITY( 1,1 ) NOT NULL,
		[HResult] BIGINT NOT NULL,
		[DTS] DATETIME,
		[Source] VARCHAR( 128 ) NOT NULL,
		[Description] VARCHAR( 1024 ) NOT NULL,
		[StackTrace] VARCHAR( 1024 ) NOT NULL,
		[Severity] SMALLINT NOT NULL,
		[User] VARCHAR( 64 ) NULL,
		[Server] VARCHAR( 32 ) NULL,
		[SessionID] VARCHAR( 128 ) NULL,
		timestamp ROWVERSION,
		CONSTRAINT [PK_ExceptionLog] PRIMARY KEY CLUSTERED( [OID] ) ON [PRIMARY]
	)
    PRINT 'Table ExceptionLog has been created successfully.'
END
ELSE BEGIN
    PRINT 'Table ExceptionLog already exists.'
END

GO

--******************************************************************************
--* Step 2. Permissions
--******************************************************************************  